On Heartbeat interval
authorJeroen van der Heijden <jeroen@transceptor.technology>
Fri, 21 Sep 2018 16:18:40 +0000 (18:18 +0200)
committerJeroen van der Heijden <jeroen@transceptor.technology>
Fri, 21 Sep 2018 16:18:40 +0000 (18:18 +0200)
src/siri/heartbeat.c

index 6d55788930b0ea95780e265c6283a471766116f9..6ee7dea0ccb1dabfebd60f37a776ffa705f7c14d 100644 (file)
@@ -74,6 +74,12 @@ static void HEARTBEAT_cb(uv_timer_t * handle __attribute__((unused)))
     {
         siridb = (siridb_t *) siridb_node->data;
 
+        /* flush the buffer, maybe on each insert or another interval? */
+        if (siridb_buffer_fsync(siridb))
+        {
+            log_critical("fsync() has failed on the buffer file");
+        }
+
         server_node = siridb->servers->first;
         while (server_node != NULL)
         {
@@ -94,10 +100,5 @@ static void HEARTBEAT_cb(uv_timer_t * handle __attribute__((unused)))
         siridb_node = siridb_node->next;
     }
 
-    /* flush the buffer, maybe on each insert or another interval? */
-    if (siridb_buffer_fsync(siridb))
-    {
-        log_critical("fsync() has failed on the buffer file");
-    }
 }